/*
  学习目标：children属性的基本使用 
  children: 特指组件标签夹着的内容区域, 可以传递任意数据类型
  步骤：
     1. 
     2. 
     3. 
*/

import React, { Component } from 'react';

export default class App extends Component {
  render() {
    return (
      <div>
        {/* <Child>{{ name: 'zs', age: 18 }}</Child> */}
        {/* <Child>
          {() => {
            alert(123);
          }}
        </Child> */}

        <Child>
          {() => {
            return <h1>hello React</h1>;
          }}
        </Child>
      </div>
    );
  }
}

class Child extends React.Component {
  render() {
    const { children } = this.props;
    const res = children();
    return <div>{res}</div>;
  }
}
